<?php $current_num = $wp_query->current_post + 1; ?>

<?php if ( $wp_query->current_post == 0 ) {
	echo '<li><ul class="shop-block-list">';
} elseif ( $wp_query->current_post % 3 == 0 ) {
	echo '<li><ul class="shop-block-list">';
} ?>

<li id="post-<?php the_ID(); ?>" <?php post_class("clearfix"); ?>>
	
	<div class="shop-block-img-wrapper">
		
		<?php if( has_post_thumbnail() ) { ?>		
			<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
				<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'image-style3' ); ?>
				<?php echo '<img src="' . $src[0] . '" alt="" />'; ?>
			</a>

		<?php } else { ?>
			<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
				<?php echo '<img src="' . get_template_directory_uri() . '/images/image2.png" alt="" />'; ?>
			</a>		
		<?php } ?>
		
	</div>
	
	<h4><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a><span><?php the_time('F jS, Y'); ?></span></h4>

</li>

<?php if ( $current_num % 3 == 0 ) {
	echo '</ul></li>';
} elseif ( $current_num == $wp_query->post_count ) {
	echo '</ul></li>';
} else {
	//echo '</li>';
} ?>